#include "parser.h"

parser::parser()
{
    stopL = new stopList("test_sw.txt");
}

QList<SList> parser::modelToList(QSqlTableModel *model)
{
    //QVector<QString> vect;
    SList vect;
    QList<SList> lst;
    for (int i = 0; i < model->rowCount(); i++)
    {
       QString ann = model->record(i).value(4).toString();
       foreach (QString str, ann.replace(QRegExp("[^\\w]+"), " ").split(" ",QString::SkipEmptyParts))
       {
           if (!stopL->isStop(str.toLower()))
           {
               vect.push_back(str.toLower());
           }
       }
       lst.push_back(vect);
       vect.clear();
    }
    return lst;
}

QString parser::morpho(QString word)
{
    return word;
}

QString parser::synonim(QString word)
{
    return word;
}
